def getMaxIndex(ls):
    n = len(ls)
    max = 0
    for i in range(n):
        if ls[i]>ls[max]:
            max = i
    return max

def getMinIndex(ls):
    n = len(ls)
    min = 0
    for i in range(n):
        if ls[i] < ls[min]:
            min = i
    return min

s = [1,2,3,4,5,6]
res = []

while len(s)>0:

    max = getMaxIndex(s)
    min = getMinIndex(s)
    res.append(s[max])
    res.append(s[min])
    del s[max]
    del s[min]

print(res)